
let x = {}

let idDescriptor = {
    get(){
        console.log( `获取 id 属性值` );
        return this._id ;
    },
    set(value){
        console.log( `为 id 属性赋值 ${value}` );
        this._id = value ;
    }
}

Object.defineProperty( x , 'id' , idDescriptor );

console.log( x.id );

x.id = 1001 ;

console.log( x.id );